<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <ui:define name="content"> 
        <f:view beforePhase="#{stakeholderULPManagerBean.initViewULPItemApplication}"/>   
        <h:form id="mainForm">
            <h1>Review ULPItem application details</h1>

            <p:fieldset id="panel"  style="width:950px">
                <p:growl id="messages" />
                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:messages />
                <h:panelGrid columns="2" columnClasses="column" cellpadding="10"  style="width:900px">
                    <h:panelGrid columns="2" border="1" columnClasses="column" cellpadding="5" style="width:450px" >

                        <h:outputText value="ULP Item Name: " style="font-weight:bold; text-align:center; font-size:12px; width:100px" />
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.name}" />

                        <h:outputText value="Company name: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.stakeholder.corpName}" />

                        <h:outputText value="Cost of item: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.costOfItem} SGD"/>

                        <h:outputText value="Maximum Issued Quantity: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.maxQuantity}"/>

                        <h:outputText value="Offer From: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.validFrom}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="Offer Until: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.validUntil}">
                            <f:convertDateTime dateStyle="full" pattern="EEE, dd/MM/yyyy" timeZone="EST" type="date" />
                        </h:outputText>

                        <h:outputText value="Voucher's Valid Period: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.validPeriod} month(s)"/>

                        <h:outputText value="Status: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.status}"/>

                        <h:outputText value="Remarks from TCube: " style="font-weight:bold; text-align:center; font-size:12px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.remarkFromTCube}"/>
                    </h:panelGrid>

                    <p:graphicImage id="imageDisplay" value="/images/upload/media/#{stakeholderULPManagerBean.selectedULPItemApplication.imageURL}"
                                    height="300" width="450"/> 

                </h:panelGrid>
                <br/>
                <p:fieldset legend="Highlights" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.highlight}" escape="false"/>
                </p:fieldset>
                <br/>
                <p:fieldset legend="Fine Print" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.fineprint}" escape="false"/>
                </p:fieldset>
                <br/>
                <p:fieldset legend="Description" toggleable="true" toggleSpeed="500"
                            onToggleUpdate="growl" style="width:900px">
                    <h:panelGrid columns="1" cellpadding="10">
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.name}" style="font-weight:bold; text-align:center; font-size:14px"/>
                        <h:outputText value="#{stakeholderULPManagerBean.selectedULPItemApplication.description}" escape="false"/>
                    </h:panelGrid>
                </p:fieldset>
                <br/>

                <p:separator />

                <h:panelGrid columns="2" columnClasses="column" cellpadding="5">
                    <p:commandButton id="back" value="Back" ajax="true" action="stakeholder/StakeholderTrackULPItemApplications?faces-redirect=true"/>
                    <p:commandButton id="void" value="Void this application" onclick="confirmation.show()" ajax="true" type="button"/>
                </h:panelGrid> 
                <p:confirmDialog message="Are you sure about voiding this ULP Item application?"  
                                 showEffect="bounce" hideEffect="explode" header="Voiding a ULPItem application" severity="alert" widgetVar="confirmation">       
                    <p:commandButton value="Yes" update="messages" oncomplete="confirmation.hide()" actionListener="#{stakeholderULPManagerBean.voidULPItemApplication}" />  
                    <p:commandButton value="No" onclick="confirmation.hide()" type="button" />   
                </p:confirmDialog>
            </p:fieldset>
        </h:form>
    </ui:define>
</ui:composition>
